home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / UTILSTEM / UTIL2.LZH / KEY-FAKE.DOC < prev    next >
Text File  |  1986-11-05  |  6KB  |  116 lines

  1.          
  2.  
  3.                           HOW  TO  USE  KEY-FAKE.COM  
  4.  
  5.          Our programming fakir turns faker to con programs into thinking 
  6.          you're actually typing the keystrokes they need to get started.  
  7.          KEY-FAKE.COM is a utility designed to extend the usefulness of 
  8.          your batch files by letting you supply all the necessary initial 
  9.          keystrokes to programs automatically.  Indeed, in addition to 
  10.          handling program preliminaries, KEY-FAKE can even be made to run 
  11.          a whole program without any keyboard intervention on your part.  
  12.                         
  13.          The author of this utility program is Charles Petzold, a 
  14.          contributing editor of PC Magazine.  The BASIC source code to 
  15.          make KEY-FAKE.COM appeared in the December 24,1985 issue of PC 
  16.          Magazine, Volume 4, Number 26.  
  17.          
  18.          USING KEY-FAKE.COM - The best way to understand how to use KEY-
  19.          FAKE and what it does is by looking at a few examples.  Suppose 
  20.          that every time you enter BASICA you execute a COLOR command to 
  21.          create a blue border and background with yellow letters and then 
  22.          usually use the F3 key to load a program.  With KEY-FAKE, you 
  23.          would create a two-line batch file to load BASICA: 
  24.          
  25.              KEY-FAKE "COLOR 14,1,1" 13 "CLS" 13 @61
  26.              BASICA
  27.          
  28.          After BASICA loads, it begins to check for commands coming from 
  29.          the keyboard.  The first keystrokes it reads, in this case, are 
  30.          those that come from the KEY-FAKE parameter.  It reads the COLOR 
  31.          command, clears the screen, and then gets ready to load a program.
  32.  
  33.          Let's look at some other examples.  You have a program called 
  34.          SpelRite that asks you for the filename and the subdirectory 
  35.          where the program is located every time you run the program and 
  36.          the program doesn't accept command line parameters.  You can use 
  37.          the following batch file called SR.BAT:  
  38.  
  39.              KEY-FAKE "%1" 13 "\SPELRITE" 13
  40.              SPELRITE
  41.          
  42.          When you enter SR followed by a filename, the name will be 
  43.          substituted for %1 when the batch executes.  KEY-FAKE then 
  44.          answers the two questions for you.
  45.  
  46.          Now for some more interesting applications of KEY-FAKE.  How 
  47.          would you like to print several WORDSTAR files using one batch 
  48.          command?  Let's call this file WSP.BAT.
  49.  
  50.              CD\WORDSTAR
  51.              :CHECK
  52.              IF /%1==/ GOTO END
  53.              KEY-FAKE "P%1" 27 "X"
  54.              WS
  55.              SHIFT
  56.              GOTO CHECK
  57.              :END
  58.          
  59.          
  60.          
  61.                                   
  62.          You executes it by typing:
  63.  
  64.              WSP file1 file2 file3 ...
  65.  
  66.          WSP.BAT uses the IF statement to check whether a parameter is 
  67.          present.  If so, the filename parameter is substituted for %1 in 
  68.          the KEY-FAKE command. Then WORDSTAR runs, executing P (for Print),
  69.          the filename, an ESC (decimal 27), and X (for EXIT).  When it 
  70.          exit back to the batch file, WSP.BAT does a SHIFT command, making 
  71.          %1 the next file in the list, and goes through the routine again.
  72.  
  73.          Some programs, like LOTUS's 1-2-3, clear out the keyboard buffer 
  74.          when they load.  When the digit 0 appears in a KEY-FAKE parameter, 
  75.          it takes on special meaning.  If a program checks to see if any 
  76.          keys are waiting, KEY-FAKE will say "NO."  The program thinks that 
  77.          no keys are available and clears the buffer.  When the program 
  78.          checks again, KEY-FAKE says "YES" and delivers the next keystroke.  
  79.  
  80.          Every time you enter 1-2-3, you do a File Retrieve command.  Use 
  81.          the batch file called L.BAT.
  82.  
  83.              CD\LOTUS
  84.              KEY-FAKE 0 13 0 13 0 13 0 13 0 13 "/FR"
  85.              LOTUS
  86.  
  87.          The string of 0s and 13s was developed empirically, but it works 
  88.          well, skipping past the LOTUS Access System Menu right into 1-2-3.
  89.  
  90.          You could even develop KEY-FAKE parameters that carry programs 
  91.          through an entire task.  For instance, you could import an ASCII 
  92.          table of numbers into 1-2-3, save it as a worksheet file, exit to 
  93.          the Lotus Access System Menu, convert the 1-2-3 file to a .DIF 
  94.          file, and then run a BASICA program that used the .DIF file, all 
  95.          by executing one batch file.
  96.  
  97.          RULE ONE  -  KEY-FAKE must be executed before the program that 
  98.                       will use the keystrokes.  
  99.          RULE TWO  -  Anything placed within a pair of single or double 
  100.                       quotes is interpreted as normal text.  
  101.          RULE THREE - ASCII codes are specified by decimal numbers.  A 13 is 
  102.                       the ENTER key, 27 is the ESC key, & a 9 is the TAB key.
  103.          RULE FOUR -  Decimal numbers preceded by the @ symbol are extended 
  104.                       ASCII codes (decimal codes 128 to 255).  
  105.          RULE FIVE -  A zero (0) is a special code to signal to programs 
  106.                       that the keyboard buffer is clear.
  107.          RULE SIX  -  The parameter length is limited to 127 characters.
  108.                                                                  
  109.          To get the complete story, see the article, which starts on 
  110.          page 215 of the above mentioned issue of PC Magazine.  
  111.  
  112.          To print this file, which is two page long, set the printer to 
  113.          the top of the page and enter the following command: 
  114.          
  115.                 A>copy KEY-FAKE.DOC prn
  116.